package com.sinosoft.jwjw.component.service.imp;


import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sinosoft.jwjw.component.mapper.DepartMentUserMapper;
import com.sinosoft.jwjw.component.model.DepartMentUser;
import com.sinosoft.jwjw.component.service.DepartMentUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service(value = "departMentUserService")
public class DepartMentUserServiceImp implements DepartMentUserService {
    /**
     * 注入部门用户管理的mapper
     */
    @Autowired
    private DepartMentUserMapper departMentUserMapper;

    @Override
    public int addUser(DepartMentUser user) {
        return 0;
    }

    @Override
    public List<DepartMentUser> findAllUser(int pageNum, int pageSize) {
        //将参数传给这个方法就可以实现物理分页了，非常简单。
        PageHelper.startPage(pageNum, pageSize);
        return departMentUserMapper.selectAllDepartMentUser();
    }

    @Override
    public Page<DepartMentUser> findAllUserByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return departMentUserMapper.selectAllDepartMentUserByPage();
    }
}
